package com.young.springdemo.service.iterator;

import java.util.ArrayList;
import java.util.List;

//抽象聚合类
public abstract class AbstractObjectList {
    private List<Object> objectList = new ArrayList<Object>();

    public AbstractObjectList(List<Object> objectList) {
        this.objectList = objectList;
    }

    public void addObject(Object object){
        this.objectList.add(object);
    }
    public void  removeObject(Object object){
        this.objectList.remove(object);
    }

    public List<Object> getObjects(){
        return this.objectList;
    }
    //声明创建迭代器对象的抽象方法
    public abstract Iterator createIterator();

}
